import { defineStore } from 'pinia'

const useAuthStore = defineStore('userInfo', {
  state: () => {
    return {
      ACCESS_TOKEN: '',
    }
  },
  getters: {
    // 获取token
    getToken() {
      return this.ACCESS_TOKEN
    },
  },
  actions: {
    setToken(token) {
      this.ACCESS_TOKEN = token
    },
    // 退出登录
    logout() {
      this.ACCESS_TOKEN = ''
    },
  },
  persist: true,
})

export default useAuthStore
